

<template>
    <div>
        <amis :amisjson="amisobj" id="btn"></amis> 
    </div>
</template>
<script setup lang="ts">

import { onMounted } from 'vue'

onMounted(() => {

})

function handleFormSubmitSucc(response) {
  console.log(response)
  document.cookie = `response=${JSON.stringify(response)}; path=/`;
}

const amisobj = {
  "type": "page",
  "body": {
    "type": "form",
    "api": "/api/user/login",
    "body": [
      {
        "type": "input-text",
        "name": "username",
        "label": "用户名："
      },
      {
        "type": "input-password",
        "name": "password",
        "label": "密码："
      }
    ],
    "submitSucc": {
    "type": "message",
    "content": "Form submitted successfully!",
    "level": "success",
    "onFinish": "handleFormSubmitSucc"
  }
  }
} 
</script>
  
<style ></style>
  